package com.demo.entity.base;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.*;

import java.io.Serializable;
import java.util.Date;


/**
 * <p>
 *
 * </p>
 *
 * @author Ymj
 * @since 2020-11-23
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;
    @JsonSerialize(using = ToStringSerializer.class)//处理后端Long类型传到前端精度丢失的正确解决方式
    @TableId(value = "id")
    private Long id;

    @TableField(fill = FieldFill.INSERT,select = false)
    private Date createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE,select = false)
    private Date updateTime;
}
